import {createStore, applyMiddleware,compose,combineReducers} from 'redux'
// import reducer from './reducer'
// 引入中间件
// import thunk from 'redux-thunk';
import thunk from 'redux-thunk';

import counterReducer from './features/counter'
import homeReducer from './features/home'

// redux-devtools
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({trace: true}) || compose;
// 单个reducer
/* const store = createStore(
    reducer,
    composeEnhancers(applyMiddleware(thunk))
); */
// 将多个reducer 合并成一个
const reducer = combineReducers({
    counter:counterReducer,
    home:homeReducer
})

const store = createStore(
    reducer,
    composeEnhancers(applyMiddleware(thunk))
);


export default store